package open3366pvp.as3.dataStruct
{
	import flash.utils.ByteArray;
	
	import open3366pvp.as3.Open3366PvpEvent;

	/**
	 * 简单区信息 
	 * @author mandyxiong
	 * 
	 */	
	public class ZoneProp implements IPvpInfo
	{
		public var gameId:uint;
		public var uid:String;
		public var zoneId:int;
		
		private var _cmdId:int;
		
		public function ZoneProp(cmdId:int):void
		{
			_cmdId = cmdId;
		}
		
		public function parasData(data:ByteArray):void
		{
			uid = data.readUTFBytes(32);
			gameId = data.readUnsignedInt();
			zoneId = data.readInt();
		}
		
		public function get eventType():String
		{
			var str:String = "";
			switch(_cmdId)
			{
				case 300: str = Open3366PvpEvent.ENTER_ZONE; break;
				case 304: str = Open3366PvpEvent.SET_ZONE_PROP; break;
				case 307: str = Open3366PvpEvent.SET_USER_PROP; break;
				case 324: str = Open3366PvpEvent.QUIT_ROOM; break;
				case 325: str = Open3366PvpEvent.QUIT_ZONE; break;
				case 326: str = Open3366PvpEvent.SET_GAME_PROP_SUCCESS; break;
			}
			return str;
		}
		
		public function toString():String
		{
			var str:String = "\n uiGameId: " + gameId + ",szUid: " + uid + ",zoneId:" + zoneId;
			switch(_cmdId)
			{
				case 300: str = "进入游戏区成功！！！" + str; break;
				case 304: str = "创建并设置区属性成功！！！" + str; break;
				case 307: str = "设置用户属性成功！！！" + str; break;
				case 324: str = "退出房间成功！！！" + str; break;
				case 325: str = "退出区成功！！！" + str; break;
				case 326: str = "设置游戏参数成功！！！" + str; break;
			}
			return str;
		}
	}
}